package com.easylinkin.linkappapi.ruleengine.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.easylinkin.linkappapi.intelligentrule.entity.IntelligentRuleExpression;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.Set;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 条件器
 * </p>
 *
 * @author TongJie
 * @since 2020-08-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("rule_condition")
@ApiModel("规则条件器实体类")
public class RuleCondition extends Model<RuleCondition> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId("id")
    @ApiModelProperty(value = "主键", example = "")
    private String id;

    /**
     * 条件类型：1-时间范围，2设备状态
     */
    @TableField("type")
    @ApiModelProperty(value = "条件类型", example = "1")
    private Integer type;

    /**
     * 规则引擎id
     */
    @TableField("rule_engine_id")
    @ApiModelProperty(value = "规则引擎id", example = "")
    private String ruleEngineId;

    /**
     * 排序标记
     */
    @TableField("sort_flag")
    @ApiModelProperty(value = "排序标记", example = "")
    private String sortFlag;

    /**
     * 创建时间
     */
    @TableField("create_time")
    @ApiModelProperty(value = "创建时间", example = "")
    private Date createTime;

    /**
     * 修改时间
     */
    @TableField("modify_time")
    @ApiModelProperty(value = "修改时间", example = "")
    private Date modifyTime;

    /**
     * 设备编号
     */
    @TableField("device_code")
    @ApiModelProperty(value = "设备编号", example = "")
    private String deviceCode;

    /**
     * 时间范围cron表达式
     */
    @TableField("time_scope_cron")
    @ApiModelProperty(value = "时间范围cron表达式", example = "")
    private String timeScopeCron;

    /**
     * 规则表达式
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "规则表达式", example = "")
    private ArrayList<IntelligentRuleExpression> intelligentRuleExpressionList;

    /**
     * 规则引擎ids
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "规则引擎ids", example = "")
    private Set<String> ruleEngineIds;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
